// page/projects/questions/questions.js
Page({
  data:{
    current:'one',
    hidden:false,
    lastAnswer:{'A':0,'B':0,'C':0,'D':0}
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  jumpLink(e){
    var _next = e.currentTarget.dataset.next,_answer = e.currentTarget.dataset.answer;
    var lastAnswer = this.data.lastAnswer;
    lastAnswer[_answer]+=1
    console.log(this.data.lastAnswer)
    if(_next=='last'){
      var dic=lastAnswer
      var sdic=Object.keys(lastAnswer).sort(function(a,b){return lastAnswer[a]-lastAnswer[b]});
      console.log(sdic)
      wx.redirectTo({
        url: '../../result/'+sdic[3]+'/index'
      })
    }
    this.setData({current:_next}) 
  }
})